<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item >设备管理</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/TGeo' }">地磁管理</el-breadcrumb-item>
        <el-breadcrumb-item>地磁日志</el-breadcrumb-item>
        </el-breadcrumb>
        <!-- 列表 -->
        <el-table  size="small" :data="TGeoLogList" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
            <el-table-column align="center" type="index" width="60">
            </el-table-column>
            <el-table-column  prop="logTime" label="时间"  show-overflow-tooltip>
            </el-table-column>
            <el-table-column  prop="pkStatus" label="泊位情况"  show-overflow-tooltip>
                <template slot-scope="scope">
                <span v-if="scope.row.pkStatus== -1">设备故障</span>
                <span v-if="scope.row.pkStatus== 0">驶出</span>
                <span v-if="scope.row.pkStatus== 1">驶入</span>
                </template>
            </el-table-column>
            <el-table-column  prop="geoStatus" label="地磁状态"  show-overflow-tooltip>
                <template slot-scope="scope">
                <span v-if="scope.row.geoStatus== -1">未激活</span>
                <span v-if="scope.row.geoStatus== 0">在线</span>
                <span v-if="scope.row.geoStatus== 1">离线</span>
                </template>
            </el-table-column>
        </el-table>
    <!-- 分页 -->
        <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pagination1.currentPage"
        :page-sizes="pagination2.pageSizes"
        :page-size="pagination1.pageSize"
        background
        layout="total, sizes, prev, pager, next, jumper"
        :total="pagination2.total">
        </el-pagination>
    </div>
</template>
<script>
    export default {
        data() {
            return {
            updateForm:{},
            TGeoLogList:[],
            loading: false, //是显示加载
            formInline:{},
            pagination1:{
                pageSize:5,
                currentPage:1,
                geoId:""
            },
            pagination2:{
                total:0,
                pageSizes:[5,10,20,50,100]
            }
            }
        },
        methods: {
            selAllOrSelByLike() {
            this.$axios.post("/geos/selAllLogs",this.pagination1)
            .then(res=>{
                this.TGeoLogList = res.data.data.TGeoLogList;
                this.pagination2.total = res.data.data.total;
            })
            .catch(error=>{
                console.log(error.data);
            })
            },
            handleSizeChange(val){
            this.pagination1.pageSize = val;
            this.pagination1.currentPage = 1;
            this.selAllOrSelByLike();
            },
            handleCurrentChange(val){
            this.pagination1.currentPage = val;
            this.selAllOrSelByLike();
            } 
        },  
        created(){
            this.pagination1.geoId = this.$route.query.geoId;
            this.selAllOrSelByLike();
        }

    
    }
</script>

<style scoped>

</style>